package Tasks;

import AI.AiEntity;
import Constructions.LifeSupport;

public class ActivateLifeSupport extends Task
{
	public LifeSupport l;
	boolean startingState, finished = false;
	
	public ActivateLifeSupport(LifeSupport l)
	{
		this.l = l;
		startingState = l.isActive();
		stepList.add(new Movement(l.getX(), l.getY()));
		urgency = 2;
	}
	
	public void performTask(AiEntity e) 
	{
		if(stepList.get(currentStep).isFinished(e))
			currentStep++;
		if(currentStep < stepList.size())
		{
			stepList.get(currentStep).performTask(e);
		}
		else
		{
			if(l.isActive())
				l.setActive(false);
			else
				l.setActive(true);
			
			finished = true;
		}
	}

	public boolean isFinished(AiEntity e) 
	{
		return finished;
	}

}
